<?
class Survey_model extends CI_Model {
	
	public function __construct()
	{
		$this->load->database();
		$this->load->helper('string');
	}

	public function set_survey_main() {
		$this->load->helper('url');

		$data = array(
			'token' => strtolower(random_string('alnum', 16)),
			//'vineyard_id' => ,
			//'location_id' => ,
			'location_description' => $this->input->post('location_description'),
			//'station_id' => ,
			'station_discription' => $this->input->post('station_discription'),
			'total_area' => $this->input->post('total_area'),
			'built_in' => $this->input->post('built_in'),
			'vineyard_lifetime' => $this->input->post('vineyard_lifetime'),
			'cost_built_meterials' => $this->input->post('cost_built_meterials'),
			'cost_built_labor' => $this->input->post('cost_built_labor'),
			'cost_renovation' => $this->input->post('cost_renovation'),
			'cost_chemical_fertilizer' => $this->input->post('cost_chemical_fertilizer'),
			'cost_organic_fertilizer' => $this->input->post('cost_organic_fertilizer'),
			'cost_regulator' => $this->input->post('cost_regulator'),
			'cost_water' => $this->input->post('cost_water'),
			'cost_electric' => $this->input->post('cost_electric'),
			'cost_pesticide' => $this->input->post('cost_pesticide'),
			'cost_fuel' => $this->input->post('cost_fuel'),
			'cost_film' => $this->input->post('cost_film'),
			'cost_plastic' => $this->input->post('cost_plastic'),
			'cost_machine_rent' => $this->input->post('cost_machine_rent'),
			'cost_labor' => $this->input->post('cost_labor'),
			'local_labor_price' => $this->input->post('local_labor_price'),
			'unpaid_labor' => $this->input->post('unpaid_labor'),
			'cost_others' => $this->input->post('cost_others'),
			'cost_others_discription' => $this->input->post('cost_others_discription')
			);
		return $this->db->insert('survey_main', $data);
	}
}